RestartSlave
Restarts the specified slave.
Syntax
KsCommandStatus RestartSlave(
int SlaveId
);
Parameters
SlaveId: the index of a slave array. When EtherCAT is started, this index has the same value as the SlaveId, which corresponds to the position of the slave in the network. Please note that after EtherCAT is started in the Operational (Op) state, any addition or removal of slaves from the network will change the position of the slaves in the network (SlaveId). Nevertheless, the index of the slave will remain the same. Newly added devices will be added in the back of the slave array. For all slaves after the change, the index and SlaveId will no longer match. This behavior is only available for physical devices; simulated devices are inapplicable. Please refer to the use cases in EnableHotConnect for more details.
Return value
Returns the KsCommandStatus structure.
Remarks
If auto-repair is disabled, use this function to restart a slave after a cable is disconnected or if it has an EtherCAT error. Access to a slave will be blocked during restart, but it won't affect the applications as the slave will return to the normal state. Typically, this function is called when the slave is in the error state and its data is already unavailable.
Usable EtherCAT states
ecatOP
Example
double autoRepair = 0.0;
nRet = GetFeatureStatus(KsFeature::featureAutoRepair, &autoRepair);
if (autoRepair != 1.0)
{
WaitForCommand(5, TRUE, RestartSlave(0));
}
Requirements
| RT | Win32 | |
|---|---|---|
| Minimum supported version | 4.0 | 4.0 |
| Header | ksapi.h | ksapi.h |
| Library | KsApi_Rtss.lib | KsApi.lib |
See also